<!--创建 `HomeBanner` 组件，在该组件中调用轮播图组件, 用于限制轮播组件的大小及位置-->
<template>
  <div class="home-banner">
    <XtxCarousel v-if="bannerList" :bannerList="bannerList" :autoPlay="true" />
  </div>
</template>
<script>
import useBanners from "@/hooks/useBanners";

export default {
  name: "HomeBanner",
  setup() {
    // const brannerList = ref([]);
    // // 获取轮播图数据
    // getBanners().then((data) => {
    //   brannerList.value = data.result;
    // });
    const { getData, banners } = useBanners();
    getData();
    return {
      bannerList: banners,
    };
  },
};
</script>
<style scoped lang="less">
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
  .xtx-carousel {
    :deep(.carousel-btn.prev) {
      left: 270px;
    }
    :deep(.carousel-indicator) {
      padding-left: 250px;
    }
  }
}
</style>
